package com.sushuo.base.bean;

import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;

import org.hibernate.annotations.DynamicInsert;
import org.hibernate.annotations.DynamicUpdate;
import org.hibernate.validator.constraints.NotEmpty;

@Entity
@Table(name="t_product")
@DynamicInsert
@DynamicUpdate
public class Product{

	@Id
	@GeneratedValue(strategy=GenerationType.AUTO)
	@Column(name="id")
	private Integer id;

//  注意 Controller 处要加 @Valid	
//  @Range(min = 2, max = 1000)
//	@NotEmpty 用在集合类上面
//	@NotBlank 用在String上面
//	@NotNull    用在基本类型上
	@NotEmpty(message="商品名不能为空")
	@Column(name="name")
	private String name;	// 商品名

	@NotEmpty()
	@Column(name="image")
	private String image;	// 图片 url，多个用英文逗号分隔，最少一张，最多九张

	@Column(name="heat")
	private Integer heat;	// 浏览数（热度）

	@Column(name="collection")
	private Integer collection;	// 收藏数

	@Column(name="gmt_modified")
	private Date gmtModified;	// 最后修改日期

	@Column(name="brand_id")
	private Integer brandId;	// 所属品牌 id

	@Column(name="user_id")
	private Integer userId;	// 设计师（用户）id

	public Integer getId(){
		return this.id;
	}
	public void setId(Integer id){
		this.id=id;
	}
	public String getName(){
		return this.name;
	}
	public void setName(String name){
		this.name=name;
	}
	public String getImage(){
		return this.image;
	}
	public void setImage(String image){
		this.image=image;
	}
	public Integer getHeat(){
		return this.heat;
	}
	public void setHeat(Integer heat){
		this.heat=heat;
	}
	public Integer getCollection(){
		return this.collection;
	}
	public void setCollection(Integer collection){
		this.collection=collection;
	}
	public Date getGmtModified(){
		return this.gmtModified;
	}
	public void setGmtModified(Date gmtModified){
		this.gmtModified=gmtModified;
	}
	public Integer getBrandId(){
		return this.brandId;
	}
	public void setBrandId(Integer brandId){
		this.brandId=brandId;
	}
	public Integer getUserId(){
		return this.userId;
	}
	public void setUserId(Integer userId){
		this.userId=userId;
	}

}